﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>

    <script src="VsLib/jquery.min.js"></script>
    <script src="VsLib/xdr.js"></script>
    <script src="VsLib/jquery.min.js"></script>
    <script src="VsLib/VsLib.min.js"></script>

    <script src="VsServiceMethod.js"></script>

    <script>
        $.support.cors = true;

        var dataForTestGetPin =
            //{
            //    "user_map_view": {
            //        "center_latlng": { "lat": 13.382761260753027, "lng": 101.1706605982538 },
            //        "bounds": {
            //            "sw": { "lat": 7.4208457685214775, "lng": 64.4763246607539 },
            //            "ne": { "lat": 19.200770967962956, "lng": 137.8649965357519 }
            //        },
            //        "zoom_lv": 4, "time_period": { "start": "2012-12-24T05:42:47.944Z", "end": "2013-01-02T04:43:22.750Z" }
            //    }, "user_authen": { "UserName": "anonymous", "UserId": "000", "key": "000" }
            //};

        {
            "user_map_view":
                {
                    "center_latlng": { "lat": 18.28781494186995, "lng": 89.6748359068345 },
                    "bounds": { "sw": { "lat": 2.916747876840908, "lng": 52.98049996933461 }, "ne": { "lat": 32.413390076445864, "lng": 126.3691718443362 } },
                    "zoom_lv": 4, "time_period": { "start": "2013-01-23T08:06:41.386Z", "end": "2013-01-31T15:43:12.401Z" }
                },
            "user_authen": { "UserName": "anonymous", "UserId": "000", "key": "000" }
        };

        $(function () {

            var serviceMethod = new VsSeviceMethod();

            $('button').click(function () {


                serviceMethod.getPinId(dataForTestGetPin.user_map_view, dataForTestGetPin.user_authen, function (data) {


                    var value = 'data length = ' + data.length + '<br/>';;

                    var num = 0;
                    serviceMethod.getPinByIds(data, dataForTestGetPin.user_authen, function (r) {

                        var reslut = '';

                        for (var i = 0; i < 10 && i < r.length; i++) {

                            var d = r[i];

                            reslut += d['cates'];

                            for (var j in d) {
                                var str = typeof d[j] == "object" ? JSON.stringify(d[j]) : d[j];
                                reslut += j + ' : ' + str + ' ' + '<br/>';
                            }

                            value += reslut + '<br/>' + (++num) + '-----------------------------------------------------<br/>';

                        }
                        $('#content').html(value);

                    });
                   

                });
            });
        
        });

    </script>
</head>
<body>

    <button>test Service</button>
    <div id="content"></div>
</body>
</html>
